import { createStore, applyMiddleware, compose } from 'redux';
import { routerMiddleware } from 'react-router-redux';
import Reducers from '../reducers';
import thunk from 'redux-thunk';

export default function storeCreater(history, initialState){

  const middlewares = [
    thunk, // 异步操作中间件
    routerMiddleware(history), // 路由中间件
  ];

  const store = createStore(
    Reducers,
    initialState,
    applyMiddleware(...middlewares)
  );

  return store;
};
